<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>待分配订单列表</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#importBox_goods").hide();
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
		function close_imbox(){
		     
			$("#importBox_goods").hide();
		}
		
		function show(n){
			$("#idss").val(n);
			$("#importBox_goods").show();
		}
		
		function confirm_imbox(){
			$("#forms").submit();
			$("#importBox_goods").hide();
		}
	</script>
	
	<style>
		#importBox_goods{
			position:fixed;
			padding:0 15px;
			width:320px;
			height:200px;
			background:#FFF;
			top:10%;
			left:25%;
			margin:0 auto;
			border:1px solid #CCC;
			box-shadow:3px 3px 10px 4px #DDD;
			z-index: 9999;
			
		}
		#importBox_goods .ib_title{
			margin-bottom:35px;
		}
		.form-search .ul-form li label{
			width: 85px;
		}
	</style>
</head>
<body>
    <div id="importBox_goods" class="hide">
			<div class='ib_title'>
			 <h3>分配业务员</h3>
			</div>
			 <form action="${ctx }/sys/orders/upSaleMan" method="post" id="forms">
					<input type='hidden' class='index'> 
					<select class="hy" style='width:300px;' name='name' id="sshh">
							<c:forEach items='${user}' var='user'> 
							<option value="${user.id }">
							${user.name }
							</option>
							</c:forEach>
					</select>
					<input type="hidden" name="id" id="idss"/>
			    </form>
					<br><br>
					<input id="btnCancel" class="btn" type="button" style='margin-left:180px;' value="确定" onclick="confirm_imbox()"/>
					<input id="btnCancel" class="btn quxiao" type="button" style='margin-left:5px;' value="取消" onclick="close_imbox()"/>
	</div>
	
	
	
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/orders/assignSaleMan">待分配订单列表</a></li>
		<%-- <shiro:hasPermission name="sys:orders:edit"><li><a href="${ctx}/sys/orders/form">订单管理添加</a></li></shiro:hasPermission> --%>
	</ul>
	<form:form id="searchForm" modelAttribute="orders" action="${ctx}/sys/orders/assignSaleMan" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
		
		    <li><label>订单编号：</label>
				<form:input path="code" htmlEscape="false" maxlength="50" class="input-medium"/>
			</li>
			 <li><label>下单时间：</label>
				<input name="startTime" type="text" readonly="readonly" placeholder="开始时间" class="input-medium Wdate " 
					value="<fmt:formatDate value="${order.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/>"
			         onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			     &nbsp;&nbsp;&nbsp;&nbsp;
			     <input name="endTime" type="text" readonly="readonly" placeholder="结束时间" class="input-medium Wdate " 
					value="<fmt:formatDate  value="${order.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/>"
			     onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/> 
			</li> 
			<li><label>下单门店：</label><form:select id="buyStoreCode" path="buyStoreCode" class="input-medium">
			<form:option value="" label="下单门店"/>
			<form:options items="${store}" htmlEscape="false" itemValue="code" itemLabel="cnName"/>
			</form:select>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>订单编号</th>
				<th>下单时间</th>
				<th>用户类型</th>
				<th>下单用户</th>
				<th>所属门店</th>
				<th>所属业务员</th>
				<th>订单金额</th>
				<th>下单门店</th>
				<th>状态</th>
				<shiro:hasPermission name="sys:orders:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="orders" varStatus="status">
			<tr>
			    <td>${status.index+1}</td>
			    <td><a href="${ctx}/sys/orders/form?id=${orders.id}&tagUrl=${ctx}/sys/orders/assignSaleMan&tagName=1">${orders.code }</a></td>
				<td>
					<fmt:formatDate value="${orders.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>${fns:getDictLabel(orders.userType, 'user_type', '')}</td>
				<td>
				<c:if test="${orders.userType=='1' }">
				${orders.userName }
				</c:if>
				<c:if test="${orders.userType=='2' }">
				${orders.company }
				</c:if>
				</td>
				<td>${orders.suoStore}</td>
				<td>${orders.suoYe }</td>
				<td>${orders.payMoney }</td>
				<td>${orders.buyStoreName }</td>
				<td>${fns:getDictLabel(orders.state, 'orders_state', '')}</td>
			
				<shiro:hasPermission name="sys:orders:edit"><td>
    				<a href="javascript:void(0)" onclick="show(${orders.id})">分配业务员</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>